#include<bits/stdc++.h>
#define int long long
using namespace std;
int n,op,f,t,b,k,now,cnt;
struct node{
	long double d;
	int f,t,b,id;
}l[5010];
int gcd(int a,int b){
	if(a==0) return b;
	return gcd(b,a%b);
}
long double qj(long double x){
	long double res=0;
	for(int i=1;i<=now;i++)
		res+=abs(1.0*l[i].t*(l[i].f-x)+l[i].b);
	return res;
}
signed main(){
	freopen("love.in","r",stdin);
	freopen("love.out","w",stdout);
	scanf("%lld",&n);
	while(n--){
		long double ans;
		scanf("%lld",&op);
		if(op==1){
			scanf("%lld%lld%lld",&f,&t,&b);
			int fz=b+f*t,fm=t;
			cnt++;
			l[++now]={1.0*b/t+f,f,t,b,cnt};
			for(int i=now;i>1;i--)
				while(l[i].d<l[i-1].d) swap(l[i],l[i-1]);
		}else{
			scanf("%lld",&k);
			int wz;
			for(int i=1;i<=now;i++)
				if(l[i].id==k) wz=i;
			now--;
			for(int i=wz;i<=now;i++)
				l[i]=l[i+1];
		}
		int sum=0,sumn=0;
		for(int i=1;i<=now;i++)
			sum+=abs(l[i].t);
		for(int i=1;i<=now;i++){
			sumn+=abs(l[i].t);
			if(1.0*sumn>=1.0*sum/2){
				ans=min(qj(l[i-1].d),qj(l[i].d));
				break;
			}
		}
		printf("%.10Lf\n",ans);
	}
	return 0;
}
